Skip to content

Adapt AI Agent Monitoring for potel #4551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jul 10, 2025

Conversation

szokeasaurusrex
Copy link
Member

@szokeasaurusrex szokeasaurusrex commented Jul 7, 2025

Port the openai-agents integration to potel-base.

Copy link

codecov bot commented Jul 7, 2025

Codecov Report

Attention: Patch coverage is 90.00000% with 26 lines in your changes missing coverage. Please review.

Project coverage is 84.91%. Comparing base (23a49e8) to head (47c9ce7).
Report is 1 commits behind head on potel-base.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...dk/integrations/openai_agents/patches/agent_run.py 85.07% 6 Missing and 4 partials ⚠️
...ry_sdk/integrations/openai_agents/patches/tools.py 83.87% 4 Missing and 1 partial ⚠️
...k/integrations/openai_agents/spans/execute_tool.py 86.36% 0 Missing and 3 partials ⚠️
sentry_sdk/integrations/openai_agents/__init__.py 90.00% 2 Missing ⚠️
...y_sdk/integrations/openai_agents/patches/models.py 91.30% 2 Missing ⚠️
sentry_sdk/integrations/openai_agents/utils.py 92.85% 2 Missing ⚠️
...y_sdk/integrations/openai_agents/patches/runner.py 95.45% 0 Missing and 1 partial ⚠️
...k/integrations/openai_agents/spans/invoke_agent.py 94.44% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff               @@
##           potel-base    #4551      +/-   ##
==============================================
+ Coverage       75.55%   84.91%   +9.36%     
==============================================
  Files             144      158      +14     
  Lines           15011    15361     +350     
  Branches         2375     2422      +47     
==============================================
+ Hits            11341    13044    +1703     
+ Misses           2839     1569    -1270     
+ Partials          831      748      -83     
Files with missing lines Coverage Δ
sentry_sdk/integrations/__init__.py 89.74% <ø> (+2.56%) ⬆️
sentry_sdk/integrations/openai_agents/consts.py 100.00% <100.00%> (ø)
...sdk/integrations/openai_agents/patches/__init__.py 100.00% <100.00%> (ø)
...y_sdk/integrations/openai_agents/spans/__init__.py 100.00% <100.00%> (ø)
...integrations/openai_agents/spans/agent_workflow.py 100.00% <100.00%> (ø)
..._sdk/integrations/openai_agents/spans/ai_client.py 100.00% <100.00%> (ø)
...ry_sdk/integrations/openai_agents/spans/handoff.py 100.00% <100.00%> (ø)
...y_sdk/integrations/openai_agents/patches/runner.py 95.45% <95.45%> (ø)
...k/integrations/openai_agents/spans/invoke_agent.py 94.44% <94.44%> (ø)
sentry_sdk/integrations/openai_agents/__init__.py 90.00% <90.00%> (ø)
... and 5 more

... and 44 files with indirect coverage changes

@sentrivana
Copy link
Contributor

sentrivana commented Jul 9, 2025

Somewhat better diffable overview of the relevant changes (unfortunately also has some master stuff in it): https://github.com/getsentry/sentry-python/compare/f0ad7ac0a64e9d9aac350558c89513fe4541e21c..d8118e5001ceb2510f4cfc0cf7d9eb625cf77955

The actual changes are:

  • making sure we finish the correct span c4ab8cc
  • making sure we finish the correct span 2 273a6af
  • changing set_data to set_attribute 44e518d
  • fixing a pydantic deprecation warning 6dd14ef
  • changing type comments to annotations

@sentrivana sentrivana marked this pull request as ready for review July 9, 2025 13:09
@sentrivana sentrivana requested a review from a team as a code owner July 9, 2025 13:09
@sentrivana sentrivana changed the title wip: Adapt AI Agent Monitoring for potel Adapt AI Agent Monitoring for potel Jul 9, 2025
Copy link
Member

@antonpirker antonpirker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

One question: why have you removed the asserts for span description?

@szokeasaurusrex
Copy link
Member Author

@antonpirker I am unsure which assertions you are referring to, but in one of the tests the description assertions are no longer needed because they are already checked by the logic that locates the spans in the spans array and assigns them to the correct variable

@sentrivana
Copy link
Contributor

One question: why have you removed the asserts for span description?

Not sure, @szokeasaurusrex did that in c4ab8cc, maybe because of the op-name-description logic in potel there's now no description?

Is description needed for the insights module?

@szokeasaurusrex
Copy link
Member Author

One question: why have you removed the asserts for span description?

Not sure, @szokeasaurusrex did that in c4ab8cc, maybe because of the op-name-description logic in potel there's now no description?

Is description needed for the insights module?

@sentrivana @antonpirker see my earlier reply. The assertions were made redundant by the logic which selects the spans based on their description

@antonpirker
Copy link
Member

ok, understand.

I brought the asserts back. They are part of the OTel semantic conventions and a couple of asserts more does not make a performance difference and it also makes the tests easier to read and understand what the description should look like.

@antonpirker antonpirker merged commit 0f9f51c into potel-base Jul 10, 2025
123 checks passed
@antonpirker antonpirker deleted the szokeasaurusrex/agents-potel branch July 10, 2025 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants